package top.shaozuo.simple.user.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

import org.apache.commons.lang.StringUtils;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;

import top.shaozuo.web.mvc.PageController;

/**
 * 注册成功跳转页面
 * 
 * @author shaozuo
 *
 */
@Path("/config")
public class ConfigController implements PageController {

    // get access to the Config instance
    private Config config = ConfigProvider.getConfig();

    @POST
    @GET
    @Path("/info")
    @Override
    public String execute(HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        String propertName = request.getParameter("pName");
        if (StringUtils.isNotBlank(propertName)) {
            String value = config.getValue(propertName, String.class);
            request.setAttribute("pName", propertName);
            request.setAttribute("pValue", value);
        }
        return "configInfo.jsp";
    }

}
